FROM ubuntu
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get install -y software-properties-common \
&&  add-apt-repository ppa:apt-fast/stable \
&&  add-apt-repository ppa:ondrej/php  \
&&  apt-get update \
&&  apt-get install -y  apt-fast 
RUN apt-fast -y install libreadline-dev libpcre3-dev libssl-dev perl zlib1g-dev  make gcc
RUN apt-fast -y install git vim zip unzip net-tools wget curl


RUN cd /usr/local/src \
&& wget https://openresty.org/download/openresty-1.19.9.1.tar.gz  \
&& tar xzvf openresty-1.19.9.1.tar.gz \
&& cd openresty-1.19.9.1 \
&& ./configure && make && make install

RUN apt-fast -y install  php7.1 php7.1-cli php7.1-dom  php7.1-dev   php-pear  php7.1-fpm php7.1-mysql php7.1-curl  php7.1-mbstring php7.1-xml php7.1-intl  php7.1-redis php7.1-gd php7.1-zip redis php7.1-mongodb
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
RUN ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/sbin/nginx \
&& ln -s /usr/local/openresty/nginx/conf /etc/nginx \
&& sed -i -e "s#/run/php/php7.1-fpm.sock#127.0.0.1:9000#g"  /etc/php/7.1/fpm/pool.d/www.conf \
&& mkdir /usr/local/openresty/nginx/conf/sites
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf 
COPY ./nginx/web.conf /etc/nginx/sites/
WORKDIR /www/workspace/
EXPOSE 80
CMD nginx && php-fpm7.1 && redis-server

